<template>
  <div class="goodcomment">
    <nav-bar bgc="#fff">
      <template #left>
        <go-back>
          <template>
            <img src="~assets/images/icon/goback.svg" alt />
          </template>
        </go-back>
      </template>
      <template #center>
        <span>所有评论</span>
      </template>
    </nav-bar>
    <comment-cate :datas="comment.categroy"></comment-cate>
    <comment-content :datas="comment.content"></comment-content>
  </div>
</template>

<script>
import NavBar from "components/public/navbar/NavBar";
import CommentCate from "components/private/good_comment/GoodCommentCategroy";
import CommentContent from "components/private/good_comment/GoodCommentContent";
import GoBack from "components/public/goback/GoBack";
export default {
  name: "GoodComment",
  data() {
    return {
      comment: {
        content: null,
        categroy: null
      }
    };
  },
  components: {
    NavBar,
    GoBack,
    CommentCate,
    CommentContent
  },
  computed: {
    goodId() {
      return this.$route.params.id;
    }
  },
  methods: {
    request() {
      this.$axios({
        url: "/comment",
        method: "get",
        params: {
          gid: this.goodId
        }
      }).then(res => {
        console.log(res);
        this.comment.categroy = res.comment_cate;
        this.comment.content = res.comment
      });
    }
  },
  created() {
    this.request()
  }
};
</script>

<style lang="less" scoped>
.goodcomment {
  margin-top: 45PX;
}
</style>